#include "MultiplyTable.h"
#include "SimpleElementS.h"
#include "ExtendElementS.h"
#include "PubKeyEquationGroup.h"
#include "matrix.h"
#include "SFLASH.h"
#include "Initial.h"

#include <vector>
#include <iostream>

extern void KeyGenerator(Matrix<SimpleElementS>& firstLinear, Matrix<SimpleElementS>& secondLinear,size_t littleDimen,size_t bigDimen);

int SFLASHTest()
{
	using namespace std;
	InitialDimen(7, 37);
	Matrix<SimpleElementS> firstLinear(37,37),secondLinear(37,37);
	KeyGenerator(firstLinear,secondLinear, 7,37);
	SFLASH sflash(firstLinear,secondLinear);

	vector<SimpleElementS> plain,cipher;
	plain.resize(37);
	int elementNum = 1 << 7;


	for (size_t tryCount = 0; tryCount < 1; tryCount++)
	{

		for (size_t i = 0; i < 37; i++)
		{
			plain[i] = rand() % elementNum;
		}

		for (size_t i = 0; i < 37; i++)
		{
			cout<<plain[i]<<" ";
		}
		cout<<endl;

		sflash.encrypt(plain, cipher);
		for (size_t i = 0; i < 37; i++)
		{
			cout<<cipher[i]<<" ";
		}
		cout<<endl;

		sflash.decrypt(cipher, plain);
		for (size_t i = 0; i < 37; i++)
		{
			cout<<plain[i]<<" ";
		}
		cout<<endl;
	}

	return 0;
}

// int main()
// {
// 	return SFLASHTest();
// }